<?php

namespace App\Admin\Renderable;

use App\Admin\Repositories\MemberFollow;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class MemberFollowTable extends LazyRenderable
{
    public function grid(): Grid
    {
        return Grid::make(new MemberFollow(['follow_member']), function (Grid $grid) {
            $grid->model()->where('member_id', $this->payload['member_id'])->orderByDesc('id');

            $grid->column('follow_id', '用户ID');
            $grid->column('follow_member.nickname', '用户名称');
            $grid->column('follow_member.avatar', '用户头像')->image(' ', 50);
            $grid->column('created_at', '关注时间');

            $grid->paginate(10);

            $grid->disableToolbar();
            $grid->disableActions();
            $grid->disableRowSelector();
        });
    }
}
